import sys
sys.path.append("../")
from model.CommonDb import *
from services.BaseService import *
from frameworks.utils.FileUtil import *
import pandas as pd
import datetime

class StockHoldsDetailService(BaseService):
    def __init__(self):
        super(StockHoldsDetailService, self).__init__()
        self.db = CommonDb("stock_holds_detail","stock")

    def addDetail(self,info):
        return self.db.add(info)

    def getDetail(self,actid,code):
        sql = "select * from stock_holds_detail where actid='" + actid + "' and code='"+ code +"';"
        return self.db.executeMap(sql)

    def getAllDetail(self,actid):
        sql = "select * from stock_holds_detail where actid='" + actid + "';"
        return self.db.executeMap(sql)

    def deleteDetail(self,actid,code):
        return self.db.delete_where("actid='" + actid + "' and code='"+ code +"';")
